package com.zzl.boot.bigevent.mapper;

import com.zzl.boot.bigevent.pojo.tag;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface tagMapper {
    //添加标签
    @Select("insert into tag(tag_name,create_time,update_time) " +
            "values (#{tagName},now(),now())")
    void add(String tagName);
    //获取标签列表
    @Select("select * from tag")
    List<tag> getList();
    //修改标签
    @Select("update tag set tag_name=#{tagName} where id=#{id}")
    void update(tag tag);
    //删除标签
    @Select("delete from tag where id=#{id}")
    void del(Integer id);

    @Select("select count(*) from article_tag_ref where tag_id= #{id}")
    Integer artilceCount(Integer id);
}
